package cn.com.headfree.evaluation.controller;

import cn.com.headfree.base.controller.ExBaseController;
import cn.com.headfree.base.controller.ResultData;
import cn.com.headfree.entity.*;
import cn.com.headfree.expert.service.IRulerService;
import cn.com.headfree.expert.service.IUserDataInfoServiceThreeYear;
import cn.com.headfree.util.SaiUtil;
import cn.com.headfree.util.SysDictionaryUtil;
import cn.com.headfree.vo.*;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

/**
 * 人才申报
 */
@Controller
@RequestMapping(value = "/talentDeclaration/evaluation", produces = "application/json;charset=UTF-8")
public class TalentDeclarationThreeYearController extends ExBaseController {
    private static final Logger LOG = LogManager.getLogger(TalentDeclarationThreeYearController.class);

    @Autowired
    private IUserDataInfoServiceThreeYear userDataInfoService;
    @Autowired
    private IRulerService rulerService;
    // 年度绩效
//    @Value("${t_year_effect_info}")
//    private String t_year_effect_info;

    /**
     * 年度绩效
     */

    @GetMapping("/getPageYearEffect")
    @ResponseBody
    public ResultData getPageYearEffect(  TYearEffectInfo tYearEffectInfo) {
        ResultData rs = new ResultData();
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        rs = checkErpNoIsNull(tYearEffectInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("01");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            int grade=0;
            //获取荣誉规则
            Double num=0.0;
            List<TalentstandardsRuleTypeLZGXVo> talentstandardsRuleTypeLZGXVoList = rulerService.getTalentstandardsRuleTypeLZGXVoList();
            List<TYearEffectInfo> pageYearEffectByCondi = userDataInfoService.findPageYearEffectByCondi(tYearEffectInfo);
            if (!pageYearEffectByCondi.isEmpty()) {
                for(TYearEffectInfo p:pageYearEffectByCondi){
                    p.setPerforGradeName(SysDictionaryUtil.getNameByValueForDefault("PerformLevelRecentThreeYears",
                            p.getPerforGrade()));// 绩效等级
                    num+=p.getCurInte();
                }
            }
            for (int i = 0; i < talentstandardsRuleTypeLZGXVoList.size(); i++) {
                if(talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMin().doubleValue()<num&&talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMax().doubleValue()>=num){
                    grade=talentstandardsRuleTypeLZGXVoList.get(i).getValue();
                    continue;
                }
            }
            //获取最大条目阈值数的数据，并计算分数总和
            List<TYearEffectInfo> resdata=new ArrayList<TYearEffectInfo>();
            if(pageYearEffectByCondi.size()>entryMax){
                for (int j = 0; j < pageYearEffectByCondi.size(); j++) {
                    if(j+1<=entryMax){
                        resdata.add(pageYearEffectByCondi.get(j));
                        for (int i = 0; i < talentstandardsRuleTypeLZGXVoList.size(); i++) {
                            if(talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMin().doubleValue()<num&&talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMax().doubleValue()>=num){
                                grade=talentstandardsRuleTypeLZGXVoList.get(i).getValue();
                                continue;
                            }
                        }
                    }
                }
//                int index=1;
//                while (iterator.hasNext()){
//                    num+=iterator.next().getCurInte();
//                    if(index>entryMax){
//                        iterator.remove();
//                    }else {
//                        for (int i = 0; i < talentstandardsRuleTypeLZGXVoList.size(); i++) {
//                            if(talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMin().doubleValue()<num&&talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMax().doubleValue()>=num){
//                                grade=talentstandardsRuleTypeLZGXVoList.get(i).getValue();
//                                continue;
//                            }
//                        }
//                    }
//                    index++;
//                }
            }else {
                for (int j = 0; j < pageYearEffectByCondi.size(); j++) {
                        resdata.add(pageYearEffectByCondi.get(j));
                        for (int i = 0; i < talentstandardsRuleTypeLZGXVoList.size(); i++) {
                            if(talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMin().doubleValue()<num&&talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMax().doubleValue()>=num){
                                grade=talentstandardsRuleTypeLZGXVoList.get(i).getValue();
                                continue;
                            }
                        }
                }
            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("data",resdata);
            total.put("total",grade);
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查找个人年度绩效成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找个人年度绩效失败！");
            e.printStackTrace();
        }
        return rs;
    }
//    @RequestMapping("/getYearEffectForSalary")
//    @ResponseBody
//    public ResultData getYearEffectForSalary(HttpServletRequest request, String erpNo, String ruleId, int year) {
//        ResultData rs = new ResultData();
//        if (StringUtil.isNullOrEmpty(erpNo) || StringUtil.isNullOrEmpty(ruleId) || year == 0) {
//            rs.setSuccess(false);
//            rs.setErrorMsg("参数错误");
//            return rs;
//        }
//        try {
//            User user = this.getLoginUserInfo(request);
//            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("01");
//            List<Map<String,Object>> data=new ArrayList<>();
//            Map<String,Object> map=new HashMap<>();
//            //今年
//            List<YearEffectVo> yearEffectVos = userDataInfoService.getYearEffectByErpNo(erpNo, t_year_effect_info,ruleId, year, user.getBaseOrgId(),talentstandardsRuleTypeVoList.getEntryMax()==null?0:talentstandardsRuleTypeVoList.getEntryMax());
//            map.put("year",year);
//            map.put("value",yearEffectVos.get(0).getPerforGrade());
//            data.add(map);
//            map.clear();
//            //去年
//            List<YearEffectVo> yearEffectVos1 = userDataInfoService.getYearEffectByErpNo(erpNo, t_year_effect_info,ruleId, year-1, user.getBaseOrgId(),talentstandardsRuleTypeVoList.getEntryMax()==null?0:talentstandardsRuleTypeVoList.getEntryMax());
//            map.put("year",year);
//            map.put("value",yearEffectVos1.get(0).getPerforGrade());
//            data.add(map);
//            map.clear();
//            //前年
//            List<YearEffectVo> yearEffectVos2 = userDataInfoService.getYearEffectByErpNo(erpNo, t_year_effect_info,ruleId, year-2, user.getBaseOrgId(),talentstandardsRuleTypeVoList.getEntryMax()==null?0:talentstandardsRuleTypeVoList.getEntryMax());
//            map.put("year",year);
//            map.put("value",yearEffectVos2.get(0).getPerforGrade());
//            data.add(map);
//            map.clear();
//            Double total=yearEffectVos.get(0).getPoint()+yearEffectVos1.get(0).getPoint()+yearEffectVos2.get(0).getPoint();
//            Integer grade=0;
//            List<TalentstandardsRuleTypeLZGXVo> talentstandardsRuleTypeLZGXVoList = rulerService.getTalentstandardsRuleTypeLZGXVoList();
//            for (int i = 0; i < talentstandardsRuleTypeLZGXVoList.size(); i++) {
//                if(talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMin().doubleValue()<total&&talentstandardsRuleTypeLZGXVoList.get(i).getIntegralMax().doubleValue()<total){
//                    map.put("total",talentstandardsRuleTypeLZGXVoList.get(i).getValue());
//                    data.add(map);
//                    break;
//                }
//
//            }
//            rs.setData(data);
//            rs.setSuccess(true);
//            LOG.info("查找年度绩效成功");
//        } catch (Exception e) {
//            rs.setSuccess(false);
//            rs.setErrorMsg("查找年度绩效失败！");
//            e.printStackTrace();
//        }
//        return rs;
//    }

    //教育培训
    @GetMapping("/getContiStudyInfo")
    @ResponseBody
    public ResultData getPageContiStudyInfo( TContiStudyInfo tContiStudyInfo) {
        ResultData rs = new ResultData();
        rs = checkErpNoIsNull(tContiStudyInfo.getErpNo());
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("0201");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            int grade=0;
            //获取荣誉规则
            List<TalentstandardsRuleTypeCCYRVo> talentstandardsRuleTypeCCYRVoList = rulerService.getTalentstandardsRuleTypeCCYRVoList();
            //构建荣誉级别对应关系
            Map<String,List<String>> map=new HashMap<>();
            List<String> levelList1=new ArrayList<>();//国网级及以上
            List<String> levelList2=new ArrayList<>();//省公司级
            List<String> levelList3=new ArrayList<>();//地市公司级
            levelList1.add("1");
            map.put("01",levelList1);
            levelList2.add("2");
            map.put("02",levelList2);
            levelList3.add("3");
            map.put("03",levelList3);
            List<TContiStudyInfo> pageContiStudyInfoByCondi = userDataInfoService.findPageContiStudyInfoByCondi(tContiStudyInfo);
            if (!pageContiStudyInfoByCondi.isEmpty()) {
                pageContiStudyInfoByCondi.forEach(p -> {
                    p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("PeixunshoukeType", p.getType()));//类型
                    p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("PeixunshoukeLevel", p.getLevel()));// 等级
                    if(StringUtils.isEmpty(p.getType())||org.springframework.util.StringUtils.isEmpty(p.getLevel())){
                        return;
                    }
                    //计算每条数据的分数
                    for (int j = 0; j <talentstandardsRuleTypeCCYRVoList.size() ; j++) {
                        if(map.get(talentstandardsRuleTypeCCYRVoList.get(j).getElementLevel())==null){
                            continue;
                        }
                        if(map.get(talentstandardsRuleTypeCCYRVoList.get(j).getElementLevel()).contains(p.getLevel())
                        ){
                            Integer baseValue = talentstandardsRuleTypeCCYRVoList.get(j).getBaseValue();//基本分数
                            Integer period = talentstandardsRuleTypeCCYRVoList.get(j).getPeriod();
                            Integer studyLength = p.getStudyLength();//课时
                            if((p.getType().equals("01")||p.getType().equals("02"))&&talentstandardsRuleTypeCCYRVoList.get(j).getType()==1){
                                if(studyLength==null||studyLength<period){
                                    p.setPoint(0);
                                }else {
                                        int num = (studyLength - period) / talentstandardsRuleTypeCCYRVoList.get(j).getPeriodAdd()*talentstandardsRuleTypeCCYRVoList.get(j).getValue()+baseValue;
                                        p.setPoint(num);
                                }
                            }else if(p.getType().equals("03")&&talentstandardsRuleTypeCCYRVoList.get(j).getType()==2){
                                if(studyLength==null||studyLength<period){
                                    p.setPoint(0);
                                }else {
                                    int num = (studyLength - period) / talentstandardsRuleTypeCCYRVoList.get(j).getPeriodAdd()*talentstandardsRuleTypeCCYRVoList.get(j).getValue()+baseValue;
                                    p.setPoint(num);
                                }
                            }
                            continue;
                        }
                    }
                });
            }

            //将数据按照分数大小排序
            Collections.sort(pageContiStudyInfoByCondi,new Comparator<TContiStudyInfo>() {
                @Override
                public int compare(TContiStudyInfo o1, TContiStudyInfo o2) {
                    return o1.getPoint()- o2.getPoint();
                }
            });
            //获取最大条目阈值数的数据，并计算分数总和
            List<TContiStudyInfo> resdata=new ArrayList<>();
            if(pageContiStudyInfoByCondi.size()>entryMax){
                for (int i = 0; i < pageContiStudyInfoByCondi.size(); i++) {
                    if(i+1<=entryMax){
                        if(pageContiStudyInfoByCondi.get(i).getPoint()>0){
                            resdata.add(pageContiStudyInfoByCondi.get(i));
                            grade+=pageContiStudyInfoByCondi.get(i).getPoint();
                        }

                    }
                }
            }else {
                for (int i = 0; i < pageContiStudyInfoByCondi.size(); i++) {
                        if(pageContiStudyInfoByCondi.get(i).getPoint()>0){
                            resdata.add(pageContiStudyInfoByCondi.get(i));
                            grade+=pageContiStudyInfoByCondi.get(i).getPoint();
                        }
                }
            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("jypxdata",resdata);
            total.put("jypxtotal",grade);
            //如果教育培训的分数小于阈值
            if(grade<integralMax){
                //导师带徒
                talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("0202");
                //获取最大条目
                entryMax = talentstandardsRuleTypeVoList.getEntryMax();
                //获取最大分数
                integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
                int last=grade;
                grade=0;
                TSdtTutorPrentInfo tSdtTutorPrentInfo = new TSdtTutorPrentInfo();
                tSdtTutorPrentInfo.setErpNo(tContiStudyInfo.getErpNo());
                List<TSdtTutorPrentInfo> pageSdtTutorPrentInfoByCondi = userDataInfoService.findPageSdtTutorPrentInfoByCondi(tSdtTutorPrentInfo);
                //计算每条数据的分数
                Integer period = talentstandardsRuleTypeCCYRVoList.get(0).getPeriod();
                Integer periodAdd = talentstandardsRuleTypeCCYRVoList.get(0).getPeriodAdd();
                if(pageSdtTutorPrentInfoByCondi.size()>period){
                    grade=pageSdtTutorPrentInfoByCondi.size()/periodAdd*talentstandardsRuleTypeCCYRVoList.get(0).getValue()>integralMax?integralMax:pageSdtTutorPrentInfoByCondi.size()/periodAdd*talentstandardsRuleTypeCCYRVoList.get(0).getValue();
                }else {
                    grade=pageSdtTutorPrentInfoByCondi.size()/periodAdd*talentstandardsRuleTypeCCYRVoList.get(0).getValue()>integralMax?integralMax:pageSdtTutorPrentInfoByCondi.size()/periodAdd*talentstandardsRuleTypeCCYRVoList.get(0).getValue();
                }
                //获取最大条目阈值数的数据，并计算分数总和
                List<TSdtTutorPrentInfo> resdata_ =new ArrayList<>();
                if(pageSdtTutorPrentInfoByCondi.size()>period){
                    for (int i = 0; i <pageSdtTutorPrentInfoByCondi.size() ; i++) {
                        if(i+1<=period){
                            if(pageSdtTutorPrentInfoByCondi.size()>0){
                                resdata_.add(pageSdtTutorPrentInfoByCondi.get(i));
                            }
                        }
                    }
                }
                grade=grade>(integralMax-last)?integralMax-last:grade;
                data.put("dsdtdata",pageSdtTutorPrentInfoByCondi);
                total.put("dsdttotal",grade);
            }
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查询培训及授课经历成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查询培训及授课经历失败！");
            e.printStackTrace();
        }
        return rs;
    }
    private ResultData checkErpNoIsNull(String erpNo) {
        ResultData result = new ResultData();
        if (StringUtils.isEmpty(erpNo)) {
            result.setSuccess(false);
            result.setErrorMsg("ErpNo或记录ID参数为空");
        }
        return result;
    }


//    //导师带徒
//    @GetMapping("/getSdtTutorPrentInfo")
//    @ResponseBody
//    public ResultData getPageSdtTutorPrentInfo( TSdtTutorPrentInfo tSdtTutorPrentInfo) {
//
//        ResultData rs = new ResultData();
//        rs = checkErpNoIsNull(tSdtTutorPrentInfo.getErpNo());
//        List<Map<String,Object>> list=new ArrayList<>();
//        Map<String,Object> data=new HashMap<>();
//        Map<String,Object> total=new HashMap<>();
//        if (rs.isSuccess() != true) {
//            return rs;
//        }
//        try {
//            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("02");
//            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
//            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
//            List<TSdtTutorPrentInfo> pageSdtTutorPrentInfoByCondi = userDataInfoService.findPageSdtTutorPrentInfoByCondi(tSdtTutorPrentInfo);
//            data.put("data",pageSdtTutorPrentInfoByCondi);
//            list.add(data);
//            int dtnum=pageSdtTutorPrentInfoByCondi.size();
//            List<TalentstandardsRuleTypeCCYRVo> talentstandardsRuleTypeCCYRVoList = rulerService.getTalentstandardsRuleTypeCCYRVoList();
//            Integer period =0;
//            Integer periodAdd =0;
//            Integer value =0;
//            for (int i = 0; i < talentstandardsRuleTypeCCYRVoList.size(); i++) {
//                if(talentstandardsRuleTypeCCYRVoList.get(i).getType()==1){
//                    period = talentstandardsRuleTypeCCYRVoList.get(i).getPeriod();
//                    periodAdd = talentstandardsRuleTypeCCYRVoList.get(i).getPeriodAdd();
//                    value = talentstandardsRuleTypeCCYRVoList.get(i).getValue();
//                }
//            }
//            if(dtnum<=period||periodAdd==0||dtnum==0){
//                total.put("total",0);
//            }else {
//                int quotient = (dtnum-period)/periodAdd;
//                total.put("total",quotient*value>=integralMax?integralMax:quotient*value);
//            }
//            list.add(total);
//            rs.setData(list);
//            LOG.info("查找导师带徒信息成功");
//        } catch (Exception e) {
//            rs.setSuccess(false);
//            rs.setErrorMsg("查找导师带徒信息失败！");
//            e.printStackTrace();
//        }
//        return rs;
//    }


    //个人荣誉
    @GetMapping("/getPageHonorInfo")
    @ResponseBody
    public ResultData getPageHonorInfo(  THonorInfo tHonorInfo) {
        ResultData rs = new ResultData();
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        rs = checkErpNoIsNull(tHonorInfo.getErpNo());
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("03");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            int grade=0;
            //获取荣誉规则
            List<TalentstandardsRuleTypeGRRYVo> talentstandardsRuleTypeGRRYVoList = rulerService.getTalentstandardsRuleTypeGRRYVoList();
            //构建荣誉级别对应关系
            Map<String,List<String>> map=new HashMap<>();
            List<String> levelList1=new ArrayList<>();//国网级及以上
            List<String> levelList2=new ArrayList<>();//省公司级
            List<String> levelList3=new ArrayList<>();//地市公司级
            levelList1.add("0");
            levelList1.add("1");
            levelList1.add("2");
            map.put("01",levelList1);
            levelList2.add("3");
            map.put("02",levelList2);
            levelList3.add("4");
            map.put("03",levelList3);
            //获取所有荣誉
            List<THonorInfo> pageHonorInfoByCondi = userDataInfoService.findPageHonorInfoByCondi(tHonorInfo);
            if (!pageHonorInfoByCondi.isEmpty()) {
                pageHonorInfoByCondi.forEach(p -> {
                    p.setHonorLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getHonorLevel()));
                    p.setHonorTypeName(SysDictionaryUtil.getNameByValueForDefault("RuYuLeiBie", p.getHonorType()));
                    if(StringUtils.isEmpty(p.getHonorLevel())||org.springframework.util.StringUtils.isEmpty(p.getHonorType())){
                        return;
                    }
                    //计算每条数据的分数
                    for (int j = 0; j <talentstandardsRuleTypeGRRYVoList.size() ; j++) {
                        if(map.get(talentstandardsRuleTypeGRRYVoList.get(j).getElementLevel())==null){
                            continue;
                        }
                        if(map.get(talentstandardsRuleTypeGRRYVoList.get(j).getElementLevel()).contains(p.getHonorLevel())&&
                                talentstandardsRuleTypeGRRYVoList.get(j).getElementType().equals(p.getHonorType())
                        ){
                            p.setPoint(talentstandardsRuleTypeGRRYVoList.get(j).getValue());
                            continue;
                        }
                    }
                });
            }

//            //计算每条数据的分数
//            for (int i = 0; i <pageHonorInfoByCondi.size() ; i++) {
//                for (int j = 0; j <talentstandardsRuleTypeGRRYVoList.size() ; j++) {
//                    if(map.get(talentstandardsRuleTypeGRRYVoList.get(j).getElementLevel()).contains(pageHonorInfoByCondi.get(i).getHonorLevel())&&
//                            talentstandardsRuleTypeGRRYVoList.get(j).getElementType().equals(pageHonorInfoByCondi.get(i).getHonorType())
//                    ){
//                        pageHonorInfoByCondi.get(i).setPoint(talentstandardsRuleTypeGRRYVoList.get(j).getValue());
//                        continue;
//                    }
//                }
//            }
            //将数据按照分数大小排序
            Collections.sort(pageHonorInfoByCondi,new Comparator<THonorInfo>() {
                @Override
                public int compare(THonorInfo o1, THonorInfo o2) {
                    return o1.getPoint()- o2.getPoint();
                }
            });
            //获取最大条目阈值数的数据，并计算分数总和
            List<THonorInfo> resdata=new ArrayList<>();
            if(pageHonorInfoByCondi.size()>entryMax){
                for (int i = 0; i < pageHonorInfoByCondi.size(); i++) {
                    if(i+1<=entryMax){
                        if(pageHonorInfoByCondi.get(i).getPoint()>0){
                            resdata.add(pageHonorInfoByCondi.get(i));
                            grade+=pageHonorInfoByCondi.get(i).getPoint();
                        }
                    }
                }
            }else {
                for (int i = 0; i < pageHonorInfoByCondi.size(); i++) {
                    if(pageHonorInfoByCondi.get(i).getPoint()>0){
                        resdata.add(pageHonorInfoByCondi.get(i));
                        grade+=pageHonorInfoByCondi.get(i).getPoint();
                    }
                }
            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("data",resdata);
            total.put("total",grade);
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查找个人荣誉信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找个人荣誉信息成功！");
            e.printStackTrace();
        }
        return rs;
    }



    //学术成果
    @GetMapping("/getPageAcadeAchiveInfo")
    @ResponseBody
    public ResultData getPageAcadeAchiveInfo(  TAcadeAchiveInfo tAcadeAchiveInfo) {
        ResultData rs = new ResultData();
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        List<TPartRank> tPartRankList = new ArrayList<>();
        TPartRank tPartRank=new TPartRank();
        tPartRank.setErpNo(tAcadeAchiveInfo.getErpNo());
        tPartRankList.add(tPartRank);
        tAcadeAchiveInfo.settPartRankList(tPartRankList);
        if(!tAcadeAchiveInfo.gettPartRankList().isEmpty()){
            rs = checkErpNoIsNull(tAcadeAchiveInfo.gettPartRankList().get(0).getErpNo());
        }else{
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if(rs.isSuccess()!=true){
            return rs;
        }
        try {
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("05");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            //构建级别对应关系
            Map<String,List<String>> mapLevel=new HashMap<>();
            List<String> levelList1=new ArrayList<>();//被SCI、SSCI收录
            List<String> levelList2=new ArrayList<>();//被EI收录
            List<String> levelList3=new ArrayList<>();//在核心期刊发表
            List<String> levelList4=new ArrayList<>();//在其他普通期刊发表
            List<String> levelList5=new ArrayList<>();//由百佳图书出版社出版
            List<String> levelList6=new ArrayList<>();//由其他正式出版社出版
            levelList1.add("3");
            mapLevel.put("01",levelList1);
            levelList2.add("4");
            mapLevel.put("02",levelList2);
            levelList3.add("6");
            mapLevel.put("03",levelList3);
            levelList4.add("2");
            levelList4.add("7");
            levelList4.add("8");
            mapLevel.put("04",levelList4);
            levelList5.add("9");
            mapLevel.put("05",levelList5);
            levelList6.add("1");
            mapLevel.put("06",levelList6);
            //构建类别对应关系
            Map<String,List<String>> maptype=new HashMap<>();
            List<String> typeList1=new ArrayList<>();//第一作者
            List<String> typeList2=new ArrayList<>();//第二作者
            List<String> typeList3=new ArrayList<>();//第三作者
            List<String> typeList4=new ArrayList<>();//其它
//            typeList1.add("01");
//            typeList1.add("02");
//            typeList1.add("03");
//            typeList1.add("04");
            typeList1.add("05");
//            typeList1.add("07");
            maptype.put("01",typeList1);
            typeList2.add("06");
//            typeList2.add("08");
            maptype.put("02",typeList2);
            typeList3.add("09");
            maptype.put("03",typeList3);
            typeList4.add("99");
            maptype.put("04",typeList4);
            int grade=0;
            //获取荣誉规则
            List<TalentstandardsRuleTypeXSGXVo> talentstandardsRuleTypeXSGXVoList = rulerService.getTalentstandardsRuleTypeXSGXVoList();
            List<TAcadeAchiveInfoVo> pageAcadeAchiveInfoByCondi = userDataInfoService.findPageAcadeAchiveInfoByCondi(tAcadeAchiveInfo);
            if(!pageAcadeAchiveInfoByCondi.isEmpty()) {
                pageAcadeAchiveInfoByCondi.forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setAcadTypeName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoType", p.getAcadType()));
                    p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJb", p.getLevel()));
                    if(StringUtils.isEmpty(p.getRole())||StringUtils.isEmpty(p.getAcadType())||StringUtils.isEmpty(p.getLevel())){
                        return;
                    }
                    //计算数据分数
                    for (int j = 0; j < talentstandardsRuleTypeXSGXVoList.size(); j++) {
                        if(p.getAcadType().equals("02")){
                            if(talentstandardsRuleTypeXSGXVoList.get(j).getType()==1){
                                if(mapLevel.get(talentstandardsRuleTypeXSGXVoList.get(j).getElementLevel()).contains(p.getLevel())&&
                                        maptype.get(talentstandardsRuleTypeXSGXVoList.get(j).getElementType()).contains(p.getRole())){
                                    p.setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
                                    continue;
                                }
                            }
                        }else {
                            if(mapLevel.get(talentstandardsRuleTypeXSGXVoList.get(j).getElementLevel()).contains(p.getLevel())){
                                //第一作者
                                if(talentstandardsRuleTypeXSGXVoList.get(j).getElementType().equals("01")){
                                    if(p.getRank()==1){
                                        p.setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
                                        continue;
                                    }
                                }else  if(talentstandardsRuleTypeXSGXVoList.get(j).getElementType().equals("02")){//前20%作者
                                    Double d= Double.valueOf(p.getRank()/p.getPartCount());
                                    if(0.0<d&&d<=0.2){
                                        p.setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
                                        continue;
                                    }
                                }
                                else  if(talentstandardsRuleTypeXSGXVoList.get(j).getElementType().equals("03")){//第三作者
                                    Double d= Double.valueOf(p.getRank()/p.getPartCount());
                                    if(0.2<d&&d<=0.5){
                                        p.setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
                                        continue;
                                    }
                                }else {//其它
                                    Double d= Double.valueOf(p.getRank()/p.getPartCount());
                                    if(0.5<d){
                                        p.setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
                                        continue;
                                    }
                                }
                            }

                        }

                    }
                });
            }

//            //计算数据分数
//            for (int i = 0; i < pageAcadeAchiveInfoByCondi.size(); i++) {
//                for (int j = 0; j < talentstandardsRuleTypeXSGXVoList.size(); j++) {
//                    if(pageAcadeAchiveInfoByCondi.get(i).getAcadType().equals("02")){
//                        if(talentstandardsRuleTypeXSGXVoList.get(j).getType()==1){
//                            if(mapLevel.get(talentstandardsRuleTypeXSGXVoList.get(j).getElementLevel()).contains(pageAcadeAchiveInfoByCondi.get(i).getLevel())&&
//                                    maptype.get(talentstandardsRuleTypeXSGXVoList.get(j).getElementType()).contains(pageAcadeAchiveInfoByCondi.get(i).getRole())){
//                                pageAcadeAchiveInfoByCondi.get(i).setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
//                                continue;
//                            }
//                        }
//                    }else {
//                        if(mapLevel.get(talentstandardsRuleTypeXSGXVoList.get(j).getElementLevel()).contains(pageAcadeAchiveInfoByCondi.get(i).getLevel())){
//                            //第一作者
//                            if(talentstandardsRuleTypeXSGXVoList.get(j).getElementType().equals("01")){
//                                if(pageAcadeAchiveInfoByCondi.get(i).getRank()==1){
//                                    pageAcadeAchiveInfoByCondi.get(i).setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
//                                    continue;
//                                }
//                            }else  if(talentstandardsRuleTypeXSGXVoList.get(j).getElementType().equals("02")){//前20%作者
//                                Double d= Double.valueOf(pageAcadeAchiveInfoByCondi.get(i).getRank()/pageAcadeAchiveInfoByCondi.get(i).getPartCount());
//                                if(0.0<d&&d<=0.2){
//                                    pageAcadeAchiveInfoByCondi.get(i).setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
//                                    continue;
//                                }
//                            }
//                            else  if(talentstandardsRuleTypeXSGXVoList.get(j).getElementType().equals("03")){//第三作者
//                                Double d= Double.valueOf(pageAcadeAchiveInfoByCondi.get(i).getRank()/pageAcadeAchiveInfoByCondi.get(i).getPartCount());
//                                if(0.2<d&&d<=0.5){
//                                    pageAcadeAchiveInfoByCondi.get(i).setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
//                                    continue;
//                                }
//                            }else {//其它
//                                Double d= Double.valueOf(pageAcadeAchiveInfoByCondi.get(i).getRank()/pageAcadeAchiveInfoByCondi.get(i).getPartCount());
//                                if(0.5<d){
//                                    pageAcadeAchiveInfoByCondi.get(i).setPoint(talentstandardsRuleTypeXSGXVoList.get(j).getValue());
//                                    continue;
//                                }
//                            }
//                        }
//
//                    }
//
//                }
//            }


            //将数据按照分数大小排序
            Collections.sort(pageAcadeAchiveInfoByCondi,new Comparator<TAcadeAchiveInfoVo>() {
                @Override
                public int compare(TAcadeAchiveInfoVo o1, TAcadeAchiveInfoVo o2) {
                    return o1.getPoint()- o2.getPoint();
                }
            });
            //获取最大条目阈值数的数据，并计算分数总和
            List<TAcadeAchiveInfoVo> resdata=new ArrayList<>();
            if(pageAcadeAchiveInfoByCondi.size()>entryMax){
                for (int i = 0; i < pageAcadeAchiveInfoByCondi.size(); i++) {
                    if(i+1<=entryMax){
                        if(pageAcadeAchiveInfoByCondi.get(i).getPoint()>0){
                            resdata.add(pageAcadeAchiveInfoByCondi.get(i));
                            grade+=pageAcadeAchiveInfoByCondi.get(i).getPoint();
                        }
                    }
                }
            }else {
                for (int i = 0; i < pageAcadeAchiveInfoByCondi.size(); i++) {
                    if(pageAcadeAchiveInfoByCondi.get(i).getPoint()>0){
                        resdata.add(pageAcadeAchiveInfoByCondi.get(i));
                        grade+=pageAcadeAchiveInfoByCondi.get(i).getPoint();
                    }

                    }
            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("data",resdata);
            total.put("total",grade);
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查找学术成果成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找学术成果失败！");
            e.printStackTrace();
        }
        return rs;
    }


    //主持或参与制定地市公司级及以上规章制度
    @GetMapping("/getPageStandInfoInfo")
    @ResponseBody
    public ResultData getPageStandInfo( TStandInfo tStandInfo) {
        ResultData rs = new ResultData();
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        List<TPartRank> tPartRankList = new ArrayList<>();
        TPartRank tPartRank=new TPartRank();
        tPartRank.setErpNo(tStandInfo.getErpNo());
        tPartRankList.add(tPartRank);
        tStandInfo.settPartRankList(tPartRankList);
        if (!tStandInfo.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tStandInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("06");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            //构建级别对应关系
            Map<String,List<String>> mapLevel=new HashMap<>();
            List<String> levelList1=new ArrayList<>();//国网级及以上
            List<String> levelList2=new ArrayList<>();//省公司级
            List<String> levelList3=new ArrayList<>();//地市公司级
            levelList1.add("0");
            levelList1.add("1");
            levelList1.add("2");
            mapLevel.put("01",levelList1);
            levelList2.add("3");
            mapLevel.put("02",levelList2);
            levelList3.add("4");
            mapLevel.put("03",levelList3);
            //构建类别对应关系
            Map<String,List<String>> maptype=new HashMap<>();
            List<String> typeList1=new ArrayList<>();//主持
            List<String> typeList2=new ArrayList<>();//主要完成
            List<String> typeList3=new ArrayList<>();//其他
//            typeList1.add("01");
//            typeList1.add("02");
//            typeList1.add("03");
//            typeList1.add("04");
//            typeList1.add("05");
//            typeList1.add("07");
            typeList1.add("10");
            maptype.put("01",typeList1);
//            typeList2.add("06");
//            typeList2.add("08");
            typeList2.add("11");
            maptype.put("02",typeList2);
            typeList3.add("99");
            maptype.put("03",typeList3);
            int grade=0;
            //获取荣誉规则
            List<TalentstandardsRuleTypeZYSPVo> talentstandardsRuleTypeZYSPVoList = rulerService.getTalentstandardsRuleTypeZYSPVoList();
            List<TStandInfoVo> pageStandInfoByCondi = userDataInfoService.findPageStandInfoByCondi(tStandInfo);
            if (!pageStandInfoByCondi.isEmpty()) {
                pageStandInfoByCondi.forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("ZdbzType", p.getType()));
                    p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getLevel()));
                    p.setSort(p.getRank()+"/"+p.getPartCount());
                    if(StringUtils.isEmpty(p.getRole())||StringUtils.isEmpty(p.getType())||StringUtils.isEmpty(p.getLevel())){
                        return;
                    }
                    //计算数据分数
                    for (int j = 0; j < talentstandardsRuleTypeZYSPVoList.size(); j++) {
                        if(talentstandardsRuleTypeZYSPVoList.get(j).getType()==1){
                            if(mapLevel.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementLevel()).contains(p.getLevel())&&
                                    maptype.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementType()).contains(p.getRole())){
                                p.setPoint(talentstandardsRuleTypeZYSPVoList.get(j).getValue());
                                continue;
                            }
                        }
                    }
                });
            }

//            //计算数据分数
//            for (int i = 0; i < pageStandInfoByCondi.size(); i++) {
//                for (int j = 0; j < talentstandardsRuleTypeZYSPVoList.size(); j++) {
//                    if(talentstandardsRuleTypeZYSPVoList.get(j).getType()==1){
//                        if(mapLevel.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementLevel()).contains(pageStandInfoByCondi.get(i).getLevel())&&
//                                maptype.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementType()).contains(pageStandInfoByCondi.get(i).getRole())){
//                            pageStandInfoByCondi.get(i).setPoint(talentstandardsRuleTypeZYSPVoList.get(j).getValue());
//                            continue;
//                        }
//                    }
//                }
//            }
            //将数据按照分数大小排序
//            Collections.sort(pageStandInfoByCondi,new Comparator<TStandInfoVo>() {
//                @Override
//                public int compare(TStandInfoVo o1, TStandInfoVo o2) {
//                    return o1.getPoint()- o2.getPoint();
//                }
//            });
            //获取最大条目阈值数的数据，并计算分数总和
            List<TStandInfoVo> resdata=new ArrayList<>();
            if(pageStandInfoByCondi.size()>entryMax){
                for (int i = 0; i < pageStandInfoByCondi.size(); i++) {
//                    if(i+1<=entryMax){
//                        resdata.add(pageStandInfoByCondi.get(i));
//                    }else {
//                        grade+=pageStandInfoByCondi.get(i).getPoint();
//                    }
                    if(i+1<=entryMax){
                        if(pageStandInfoByCondi.get(i).getPoint()>0){
                            resdata.add(pageStandInfoByCondi.get(i));
                            grade+=pageStandInfoByCondi.get(i).getPoint();
                        }
                    }

                }
            }else {
                for (int i = 0; i < pageStandInfoByCondi.size(); i++) {
                    if(pageStandInfoByCondi.get(i).getPoint()>0){
                        resdata.add(pageStandInfoByCondi.get(i));
                        grade+=pageStandInfoByCondi.get(i).getPoint();
                    }

                }
            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("data",resdata);
            total.put("total",grade);
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查找制度标准成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找制度标准失败！");
            e.printStackTrace();
        }
        return rs;
    }


    //主持或参与制定地市公司级及以上技术规范
    @GetMapping("/getPageTecStandardInfo")
    @ResponseBody
    public ResultData getPageTecStandardInfo(  TTecStandardInfo tecStandardInfo) {
        ResultData rs = new ResultData();
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        try {
            //去除参数中的前后空格
            SaiUtil.beanAttributeValueTrim(tecStandardInfo);
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("06");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            //构建级别对应关系
            Map<String,List<String>> mapLevel=new HashMap<>();
            List<String> levelList1=new ArrayList<>();//国网级及以上
            List<String> levelList2=new ArrayList<>();//省公司级
            List<String> levelList3=new ArrayList<>();//地市公司级
            levelList1.add("0");
            levelList1.add("1");
            levelList1.add("2");
            mapLevel.put("01",levelList1);
            levelList2.add("3");
            mapLevel.put("02",levelList2);
            levelList3.add("4");
            mapLevel.put("03",levelList3);
            //构建类别对应关系
            Map<String,List<String>> maptype=new HashMap<>();
            List<String> typeList1=new ArrayList<>();//主持
            List<String> typeList2=new ArrayList<>();//主要完成
            List<String> typeList3=new ArrayList<>();//其他
//            typeList1.add("01");
//            typeList1.add("02");
//            typeList1.add("03");
//            typeList1.add("04");
//            typeList1.add("05");
//            typeList1.add("07");
            typeList1.add("10");
            maptype.put("01",typeList1);
//            typeList2.add("06");
//            typeList2.add("08");
            typeList2.add("11");
            maptype.put("02",typeList2);
            typeList3.add("99");
            maptype.put("03",typeList3);
            int grade=0;
            //获取荣誉规则
            List<TalentstandardsRuleTypeZYSPVo> talentstandardsRuleTypeZYSPVoList = rulerService.getTalentstandardsRuleTypeZYSPVoList();
            List<TTecStandardInfo> pageTecStandardInfoByCondi = userDataInfoService.findPageTecStandardInfoByCondi(tecStandardInfo);
            if (!pageTecStandardInfoByCondi.isEmpty()) {
                pageTecStandardInfoByCondi.forEach(p -> {
                    p.setTypeName(SysDictionaryUtil.getNameByValueForDefault("tecStandardRole", p.getType()));
                    p.setLevelName(SysDictionaryUtil.getNameByValueForDefault("TecStandardType", p.getLevel()));
                    if(StringUtils.isEmpty(p.getType())||StringUtils.isEmpty(p.getLevel())){
                        return;
                    }
                    //计算数据分数
                    for (int j = 0; j < talentstandardsRuleTypeZYSPVoList.size(); j++) {
                        if(talentstandardsRuleTypeZYSPVoList.get(j).getType()==2){
                            if(mapLevel.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementLevel()).contains(p.getLevel())&&
                                    maptype.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementType()).contains(p.getType())){
                                p.setPoint(talentstandardsRuleTypeZYSPVoList.get(j).getValue());
                                continue;
                            }
                        }
                    }
                });
            }


//            //计算数据分数
//            for (int i = 0; i < pageTecStandardInfoByCondi.size(); i++) {
//                for (int j = 0; j < talentstandardsRuleTypeZYSPVoList.size(); j++) {
//                    if(talentstandardsRuleTypeZYSPVoList.get(j).getType()==1){
//                        if(mapLevel.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementLevel()).contains(pageTecStandardInfoByCondi.get(i).getLevel())&&
//                                maptype.get(talentstandardsRuleTypeZYSPVoList.get(j).getElementType()).contains(pageTecStandardInfoByCondi.get(i).getType())){
//                            pageTecStandardInfoByCondi.get(i).setPoint(talentstandardsRuleTypeZYSPVoList.get(j).getValue());
//                            continue;
//                        }
//                    }
//                }
//            }
            //将数据按照分数大小排序
//            Collections.sort(pageTecStandardInfoByCondi,new Comparator<TTecStandardInfo>() {
//                @Override
//                public int compare(TTecStandardInfo o1, TTecStandardInfo o2) {
//                    return o1.getPoint()- o2.getPoint();
//                }
//            });
            //获取最大条目阈值数的数据，并计算分数总和
            List<TTecStandardInfo> resdata=new ArrayList<>();
            if(pageTecStandardInfoByCondi.size()>entryMax){
                for (int i = 0; i < pageTecStandardInfoByCondi.size(); i++) {
                    if(i+1<=entryMax){
                        if(pageTecStandardInfoByCondi.get(i).getPoint()>0){
                            resdata.add(pageTecStandardInfoByCondi.get(i));
                            grade+=pageTecStandardInfoByCondi.get(i).getPoint();
                        }
                    }

                }
            }else {
                for (int i = 0; i < pageTecStandardInfoByCondi.size(); i++) {
                    if(pageTecStandardInfoByCondi.get(i).getPoint()>0){
                        resdata.add(pageTecStandardInfoByCondi.get(i));
                        grade+=pageTecStandardInfoByCondi.get(i).getPoint();
                    }
                }
            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("data",resdata);
            total.put("total",grade);
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查找技术规范列表成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找技术规范列表失败！");
            e.printStackTrace();
        }
        return rs;
    }

    //专业标准
    @GetMapping("/getPageTecInnovInfo")
    @ResponseBody
    public ResultData getPageTecInnovInfo(  TTecInnovInfo tTecInnovInfo) {
        ResultData rs = new ResultData();
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        List<TPartRank> tPartRankList = new ArrayList<>();
        TPartRank tPartRank=new TPartRank();
        tPartRank.setErpNo(tTecInnovInfo.getErpNo());
        tPartRankList.add(tPartRank);
        tTecInnovInfo.settPartRankList(tPartRankList);
        if (!tTecInnovInfo.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tTecInnovInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }

        try {
            //构建级别对应关系
            Map<String,Map<String,List<String>>> map=new HashMap<>();
            List<String> levelList1=new ArrayList<>();//国网级及以上
            List<String> levelList2=new ArrayList<>();//国网级
            List<String> levelList3=new ArrayList<>();//省公司级
            List<String> levelList4=new ArrayList<>();//地市公司级
            levelList1.add("0");
            levelList1.add("1");
            levelList1.add("2");
            levelList2.add("2");
            levelList3.add("3");
            levelList4.add("4");
            //构建类别对应关系
            List<String> typeList1=new ArrayList<>();//一等奖及以上
            List<String> typeList2=new ArrayList<>();//一等奖
            List<String> typeList3=new ArrayList<>();//二等奖
            List<String> typeList4=new ArrayList<>();//三等奖
            typeList1.add("0");
            typeList1.add("1");
            typeList1.add("2");
            typeList2.add("1");
            typeList3.add("2");
            typeList4.add("4");
            Map<String,List<String>> mapdata1=new HashMap<>();//国网公司级一等奖及以上
            Map<String,List<String>> mapdata2=new HashMap<>();//国网公司级二等奖
            Map<String,List<String>> mapdata3=new HashMap<>();//国网公司级 三等奖
            Map<String,List<String>> mapdata4=new HashMap<>();//省公司级一等奖
            Map<String,List<String>> mapdata5=new HashMap<>();//省公司级二等奖
            Map<String,List<String>> mapdata6=new HashMap<>();//省公司级三等奖
            Map<String,List<String>> mapdata7=new HashMap<>();//地市公司级一等奖
            mapdata1.put("level",levelList1);
            mapdata1.put("type",typeList1);
            mapdata2.put("level",levelList2);
            mapdata2.put("type",typeList3);
            mapdata3.put("level",levelList2);
            mapdata3.put("type",typeList4);
            mapdata4.put("level",levelList3);
            mapdata4.put("type",typeList2);
            mapdata5.put("level",levelList3);
            mapdata5.put("type",typeList3);
            mapdata6.put("level",levelList3);
            mapdata6.put("type",typeList4);
            mapdata7.put("level",levelList4);
            mapdata7.put("type",typeList2);
            map.put("01",mapdata1);
            map.put("02",mapdata2);
            map.put("03",mapdata3);
            map.put("04",mapdata4);
            map.put("05",mapdata5);
            map.put("06",mapdata6);
            map.put("07",mapdata7);
            //自定义汇总集合
            List<ScreenUntilVo> listTotal=new ArrayList<>();
            //定义筛选的数据
           // ScreenUntilVo screenUntilVo;
            int grade=0;
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("04");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            //获取荣誉规则
            List<TalentstandardsRuleTypeZYBZVo> talentstandardsRuleTypeZYBZVoList = rulerService.getTalentstandardsRuleTypeZYBZVoList();
            List<TalentstandardsRuleTypeZYBZNDJBVo> talentstandardsRuleTypeZYBZNDJBVoList = rulerService.getTalentstandardsRuleTypeZYBZNDJBVoList();
            //技艺革新（QC/青创赛）
            List<TTecInnovInfoVo> pageTecInnovInfoByCondi = userDataInfoService.findPageTecInnovInfoByCondi(tTecInnovInfo);
            if (!pageTecInnovInfoByCondi.isEmpty()) {
                pageTecInnovInfoByCondi.forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
                    p.setAwardGradeName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getAwardGrade()));
                    p.setAchiTypeName(SysDictionaryUtil.getNameByValueForDefault("KjglAchiveType", p.getAchiType()));
                    p.setSort(p.getRank()+"/"+p.getPartCount());
                    if(StringUtils.isEmpty(p.getAwardLevel())||StringUtils.isEmpty(p.getAwardGrade())||StringUtils.isEmpty(p.getAchiType())){
                        return;
                    }
                    //计算数据分数
                    for (int j = 0; j < talentstandardsRuleTypeZYBZVoList.size(); j++) {
                        if(talentstandardsRuleTypeZYBZVoList.get(j).getType()!=1){
                            continue;
                        }
                        boolean flag=false;
                        if(map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("level").contains(p.getAwardLevel())
                                &&map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("type").contains(p.getAwardGrade())){
                            for (int k = 0; k <talentstandardsRuleTypeZYBZNDJBVoList.size() ; k++) {
                                if(!talentstandardsRuleTypeZYBZNDJBVoList.get(k).getElementType().equals("04")){
                                    continue;
                                }
                                if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("01")&&p.getRank()/p.getPartCount()==1){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("02")&&p.getRank()/p.getPartCount()<=0.2){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("03")&&p.getRank()/p.getPartCount()>0.2&&p.getRank()/p.getPartCount()<=0.5){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("04")&&p.getRank()/p.getPartCount()>0.5&&p.getRank()/p.getPartCount()<1){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }
                            }
                        }
                        if(flag){
                            continue;
                        }
                    }
                });
            }
            //计算数据分数
//            for (int i = 0; i < pageTecInnovInfoByCondi.size(); i++) {
//                for (int j = 0; j < talentstandardsRuleTypeZYBZVoList.size(); j++) {
//                        boolean flag=false;
//                        if(map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("level").contains(pageTecInnovInfoByCondi.get(i).getAwardLevel())
//                        &&map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("type").contains(pageTecInnovInfoByCondi.get(i).getAwardGrade())){
//                            for (int k = 0; k <talentstandardsRuleTypeZYBZNDJBVoList.size() ; k++) {
//                                if(talentstandardsRuleTypeZYBZNDJBVoList.get(k).getElementType().equals("04")){
//                                    pageTecInnovInfoByCondi.get(i).setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
//                                    flag=true;
//                                    screenUntilVo=new ScreenUntilVo();
//                                    screenUntilVo.setId(pageTecInnovInfoByCondi.get(i).getId());
//                                    screenUntilVo.setPoint(pageTecInnovInfoByCondi.get(i).getPoint());
//                                    listTotal.add(screenUntilVo);
//                                    continue;
//                                }
//                            }
//                        }
//                        if(flag){
//                            continue;
//                        }
//                }
//            }
            TTecManInnov tTecManInnov=new TTecManInnov();
            tTecManInnov.setErpNo(tTecInnovInfo.getErpNo());
            //成果获奖
            List<TTecManInnovVo> pageTecManInnovByCondi = userDataInfoService.findPageTecManInnovByCondi(tTecManInnov);
            if (!pageTecManInnovByCondi.isEmpty()) {
                pageTecManInnovByCondi.forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setAwardLevelName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcJb", p.getAwardLevel()));
                    p.setAwardGradeName(SysDictionaryUtil.getNameByValueForDefault("JygexinQcDj", p.getAwardGrade()));
                    p.setAchiTypeName(SysDictionaryUtil.getNameByValueForDefault("KjglAchiveType", p.getAchiType()));
                    p.setSort(p.getRank()+"/"+p.getPartCount());
                    //计算数据分数
                    for (int j = 0; j < talentstandardsRuleTypeZYBZVoList.size(); j++) {

                        if(talentstandardsRuleTypeZYBZVoList.get(j).getType()!=1){
                            continue;
                        }
                        boolean flag=false;
                        if(map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("level").contains(p.getAwardLevel())
                                &&map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("type").contains(p.getAwardGrade())){
                            if(StringUtils.isEmpty(p.getAwardLevel())||StringUtils.isEmpty(p.getAwardGrade())){
                                return;
                            }
                            for (int k = 0; k <talentstandardsRuleTypeZYBZNDJBVoList.size() ; k++) {
                                if(!talentstandardsRuleTypeZYBZNDJBVoList.get(k).getElementType().equals("04")){
                                    continue;
                                }
                                if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("01")&&p.getRank()/p.getPartCount()==1){
                                    if(p.getPartCount()==null){
                                        p.setPoint(0.0);
                                    }else {
                                        p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    }
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("02")&&p.getRank()/p.getPartCount()<=0.2){
                                    if(p.getPartCount()==null){
                                        p.setPoint(0.0);
                                    }else {
                                        p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    }
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("03")&&p.getRank()/p.getPartCount()>0.2&&p.getRank()/p.getPartCount()<=0.5){
                                    if(p.getPartCount()==null){
                                        p.setPoint(0.0);
                                    }else {
                                        p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    }
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("04")&&p.getRank()/p.getPartCount()>0.5&&p.getRank()/p.getPartCount()<1){
                                    if(p.getPartCount()==null){
                                        p.setPoint(0.0);
                                    }else {
                                        p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
                                    }
                                    flag=true;
                                    ScreenUntilVo  screenUntilVo=new ScreenUntilVo();
                                    screenUntilVo.setId(p.getTid());
                                    screenUntilVo.setPoint(p.getPoint());
                                    listTotal.add(screenUntilVo);
                                    continue;
                                }
                            }
                        }
                        if(flag){
                            continue;
                        }
                    }
                });
            }
//            //计算数据分数
//            for (int i = 0; i < pageTecManInnovByCondi.size(); i++) {
//                for (int j = 0; j < talentstandardsRuleTypeZYBZVoList.size(); j++) {
//                    boolean flag=false;
//                    if(map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("level").contains(pageTecManInnovByCondi.get(i).getAwardLevel())
//                            &&map.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).get("type").contains(pageTecManInnovByCondi.get(i).getAwardGrade())){
//                        for (int k = 0; k <talentstandardsRuleTypeZYBZNDJBVoList.size() ; k++) {
//                            if(talentstandardsRuleTypeZYBZNDJBVoList.get(k).getElementType().equals(pageTecManInnovByCondi.get(i).getAchiType())){
//                                pageTecManInnovByCondi.get(i).setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue()*talentstandardsRuleTypeZYBZNDJBVoList.get(k).getValue().doubleValue());
//                                flag=true;
//                                screenUntilVo=new ScreenUntilVo();
//                                screenUntilVo.setId(pageTecInnovInfoByCondi.get(i).getId());
//                                screenUntilVo.setPoint(pageTecInnovInfoByCondi.get(i).getPoint());
//                                listTotal.add(screenUntilVo);
//                                continue;
//                            }
//                        }
//                    }
//                    if(flag){
//                        continue;
//                    }
//                }
//            }
            //将数据按照分数大小排序
            Collections.sort(listTotal,new Comparator<ScreenUntilVo>() {
                @Override
                public int compare(ScreenUntilVo o1, ScreenUntilVo o2) {
                    int ret=0;
                    double v = o1.getPoint() - o2.getPoint();
                    if(v<0.0){
                        ret =-1;
                    }else if(v>0.0){
                        ret =1;
                    }
                    return ret ;
                }
            });
            //获取最大条目阈值数的数据，并计算分数总和
            List<ScreenUntilVo> resdata=new ArrayList<>();
            if(listTotal.size()>entryMax){
                for (int i = 0; i <listTotal.size() ; i++) {
                    if(i+1<=entryMax){
                        if(listTotal.get(i).getPoint()>0){
                            resdata.add(listTotal.get(i));
                            grade+=listTotal.get(i).getPoint();
                        }
                    }
                }
            }else {
                for (int i = 0; i <listTotal.size() ; i++) {
                        if(listTotal.get(i).getPoint()>0){
                            resdata.add(listTotal.get(i));
                            grade+=listTotal.get(i).getPoint();
                        }
                }
            }
            Iterator<TTecManInnovVo> iteratorCGHJ = pageTecManInnovByCondi.iterator();
            Iterator<TTecInnovInfoVo> iterator1JYGX = pageTecInnovInfoByCondi.iterator();
            List<TTecManInnovVo> listTTecManInnovVo=new ArrayList<>();
            List<TTecInnovInfoVo> listTTTecInnovInfoVo=new ArrayList<>();
            //删除非筛选出的数据
            while (iteratorCGHJ.hasNext()){
                TTecManInnovVo next = iteratorCGHJ.next();
                boolean flag=false;
                for (int i = 0; i <resdata.size() ; i++) {
                    if(resdata.get(i).getId().equals(next.getTid())){
                        listTTecManInnovVo.add(next);
                        continue;
                    }
                }

            }
            while (iterator1JYGX.hasNext()){
                TTecInnovInfoVo next = iterator1JYGX.next();
                boolean flag=false;
                for (int i = 0; i <resdata.size() ; i++) {
                    if(resdata.get(i).getId().equals(next.getTid())){
                        listTTTecInnovInfoVo.add(next);
                        continue;
                    }
                }

            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("totalCGHJ",listTTecManInnovVo);
            data.put("totalJYGX",listTTTecInnovInfoVo);
            total.put("totalCGHJ",grade);
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查找专业标准信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专业标准信息成功！");
            e.printStackTrace();
        }
        return rs;
    }

    //授权专利
    @GetMapping("/getPagePatentInfo")
    @ResponseBody
    public ResultData getPagePatentInfo(  TPatentInfo tPatentInfo) {
        ResultData rs = new ResultData();
        List<Map<String,Object>> list=new ArrayList<>();
        Map<String,Object> data=new HashMap<>();
        Map<String,Object> total=new HashMap<>();
        List<TPartRank> tPartRankList = new ArrayList<>();
        TPartRank tPartRank=new TPartRank();
        tPartRank.setErpNo(tPatentInfo.getErpNo());
        tPartRankList.add(tPartRank);
        tPatentInfo.settPartRankList(tPartRankList);
        if (!tPatentInfo.gettPartRankList().isEmpty()) {
            checkErpNoIsNull(tPatentInfo.gettPartRankList().get(0).getErpNo());
        } else {
            rs.setSuccess(false);
            rs.setErrorMsg("ErpNo为空！");
        }
        if (rs.isSuccess() != true) {
            return rs;
        }
        try {
            //构建级别对应关系
            Map<String,List<String>> mapLevel=new HashMap<>();
            List<String> levelList1=new ArrayList<>();//发明专利
            List<String> levelList2=new ArrayList<>();//实用新型或外观专利
            levelList1.add("1");
            mapLevel.put("08",levelList1);
            levelList2.add("2");
            levelList2.add("3");
            mapLevel.put("09",levelList2);
            //定义筛选的数据
            // ScreenUntilVo screenUntilVo;
            int grade=0;
            TalentstandardsRuleTypeVo talentstandardsRuleTypeVoList = rulerService.getTalentstandardsRuleTypeVoList("04");
            //获取最大条目
            Integer entryMax = talentstandardsRuleTypeVoList.getEntryMax();
            //获取最大分数
            Integer integralMax = talentstandardsRuleTypeVoList.getIntegralMax();
            //获取荣誉规则
            List<TalentstandardsRuleTypeZYBZVo> talentstandardsRuleTypeZYBZVoList = rulerService.getTalentstandardsRuleTypeZYBZVoList();
            List<TalentstandardsRuleTypeZYBZNDJBVo> talentstandardsRuleTypeZYBZNDJBVoList = rulerService.getTalentstandardsRuleTypeZYBZNDJBVoList();
            List<TPatentInfoVo> pagePatentInfoByCondi = userDataInfoService.findPagePatentInfoByCondi(tPatentInfo);
            if (!pagePatentInfoByCondi.isEmpty()) {
                pagePatentInfoByCondi.forEach(p -> {
                    p.setRoleName(SysDictionaryUtil.getNameByValueForDefault("XueshuchengguoJs", p.getRole()));
                    p.setPatentTypeName(SysDictionaryUtil.getNameByValueForDefault("PatentType", p.getPatentType()));
                    p.setSort(p.getRank()+"/"+p.getPartCount());
                    if(StringUtils.isEmpty(p.getPatentType())){
                        return;
                    }
                    //计算数据分数
                    for (int j = 0; j < talentstandardsRuleTypeZYBZVoList.size(); j++) {
                        if(talentstandardsRuleTypeZYBZVoList.get(j).getType()!=2){
                            continue;
                        }
                        boolean flag=false;
                        if(mapLevel.get(talentstandardsRuleTypeZYBZVoList.get(j).getElementLevel()).contains(p.getPatentType())){
                                if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("01")&&p.getRank()/p.getPartCount()==1){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue());
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("02")&&p.getRank()/p.getPartCount()<=0.2){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue());
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("03")&&p.getRank()/p.getPartCount()>0.2&&p.getRank()/p.getPartCount()<=0.5){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue());
                                    continue;
                                }else if(talentstandardsRuleTypeZYBZVoList.get(j).getElementType().equals("04")&&p.getRank()/p.getPartCount()>0.5&&p.getRank()/p.getPartCount()<1){
                                    p.setPoint(talentstandardsRuleTypeZYBZVoList.get(j).getValue());
                                    continue;
                                }
                        }
                    }
                });
            }
            //将数据按照分数大小排序
            Collections.sort(pagePatentInfoByCondi,new Comparator<TPatentInfoVo>() {
                @Override
                public int compare(TPatentInfoVo o1, TPatentInfoVo o2) {
                    return o1.getPoint()- o2.getPoint();
                }
            });
            //获取最大条目阈值数的数据，并计算分数总和
            List<TPatentInfoVo> resdata=new ArrayList<>();
            if(pagePatentInfoByCondi.size()>entryMax){
                for (int i = 0; i <pagePatentInfoByCondi.size() ; i++) {
                    if(pagePatentInfoByCondi.size()<=entryMax){
                        resdata.add(pagePatentInfoByCondi.get(i));
                        grade+=pagePatentInfoByCondi.get(i).getPoint();
                    }
                }
            }else {
                for (int i = 0; i <pagePatentInfoByCondi.size() ; i++) {
                        resdata.add(pagePatentInfoByCondi.get(i));
                        grade+=pagePatentInfoByCondi.get(i).getPoint();
                }
            }
            //判断分数是否大于分数最大阈值
            grade=grade>integralMax?integralMax:grade;
            data.put("data",resdata);
            total.put("total",grade);
            list.add(data);
            list.add(total);
            rs.setData(list);
            LOG.info("查找专利信息成功");
        } catch (Exception e) {
            rs.setSuccess(false);
            rs.setErrorMsg("查找专利信息失败！");
            e.printStackTrace();
        }
        return rs;
    }







}
